<?php

namespace App\Observers\Game\Center;

use App\Caches\Game\AppVersionCache;
use App\Models\Game\Center\AppVersion;

class AppVersionObserver
{
    /**
     * @param AppVersion $data
     */
    public function created(AppVersion $data)
    {
        AppVersionCache::set($data);
    }

    /**
     * @param AppVersion $data
     */
    public function updated(AppVersion $data)
    {
        AppVersionCache::del($data->replicate()->fill($data->getOriginal()));
        AppVersionCache::set($data);
    }

    /**
     * @param AppVersion $data
     */
    public function deleted(AppVersion $data)
    {
        AppVersionCache::del($data);
    }
}
